package com.pine.app.module.security.core.exception;

import com.pine.app.module.security.core.common.enums.ErrorType;
import com.pine.app.module.security.core.common.enums.ResponseProduceType;

/**
 * @author xiaoyuan
 * @create 2020/3/21 14:35
 **/
public class BaseException extends RuntimeException {

    private ErrorType errorType;

    private ResponseProduceType responseProduceTypeEnum = ResponseProduceType.JSON;

    private String pagePath;

    private Object data;

    public BaseException(ErrorType errorType) {
        this(errorType, errorType.message());
    }

    public BaseException(ErrorType errorType, ResponseProduceType responseProduceTypeEnum, String pagePath) {
        this(errorType, errorType.message(),responseProduceTypeEnum,pagePath,null);
    }

    public BaseException(ErrorType errorType, String message) {
        this(errorType,message, ResponseProduceType.JSON,"",null);
    }

    public BaseException(ErrorType errorType, String message, ResponseProduceType responseProduceTypeEnum, String pagePath,Object data) {
        super(message);
        this.errorType = errorType;
        this.responseProduceTypeEnum = responseProduceTypeEnum;
        this.pagePath = pagePath;
        this.data = data;
    }

    public ErrorType getErrorType() {
        return errorType;
    }

    public ResponseProduceType getResponseProduceTypeEnum(){
        return responseProduceTypeEnum;
    }

    public String getPagePath() {
        return pagePath;
    }

    public Object getData() {
        return data;
    }
}
